import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:high_help_apps/common/values/colors.dart';

import 'common/routes/app_pages.dart';
import 'common/utils/logger.dart';
import 'global.dart';

void main() async {
  await initService();
  runApp(MainClass());
}

Future<void> initService() async {
  await Global.init();
}

class MainClass extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: Size(375, 812 - 44 - 34),
      builder: () => GetMaterialApp(
        debugShowCheckedModeBanner: false,

        theme: ThemeData(
          primaryColor: AppColors.primaryElement
        ),

        defaultTransition: Transition.leftToRightWithFade,

        // 日志
        enableLog: true,
        logWriterCallback: Logger.write,

        // 路由
        getPages: AppPages.routes,

        // 启动页面
        initialRoute: AppRoutes.INITIAL,
      ),
    );
  }
}
